package com.mxpio.erp.common.plm.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.CreatedDatePolicy;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
public class ProjectTaskVO extends BaseEntity {

    private static final long serialVersionUID=1L;
    private String taskCode;
    /**
     * 任务执行LogId
     */
    private String taskLogId;
    /**
     * 日志类型
     */
    @Dict(dicCode = "ERP_TASK_LOG_TYPE")
    private String logType;

    @Generator(policy = CreatedDatePolicy.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "创建时间")
    private Date createTime;
    /**
     * 审核意见
     */
    @Dict(dicCode = "MB_SYSTEM_YES_NO")
    private String auditOpinion;
    /**
     * 审核状态
     */
    @Dict(dicCode = "ERP_COMMON_BPMN_STATUS")
    private String auditStatus;
    /**
     * 任务状态：1-正常、0-延期
     */
    private String proCode;
    /**
     * 任务状态：1-正常、0-延期
     */
    private String taskName;

    /**
     * 任务状态：1-正常、0-延期
     */
    @Dict(dicCode = "ERP_PROJECT_INFO_STATUS")
    private String taskStatus;
    /**
     * 任务状态：1-正常、0-延期
     */
    @Dict(dicCode = "ERP_PLM_PROJECT_TASK_TYPE")//10 项目任务 20 风险预案
    private String taskType;
    /**
     * 任务状态：1-正常、0-延期
     */
    private String parentTaskCode;
    /**
     * 任务状态：1-正常、0-延期
     */
    private String parentTaskName;

    /**
     * 任务执行状态：10-待发布、20-待启动、30-执行中、40-已完成、50-已暂停、60-已关闭
     */
    @Dict(dicCode = "ERP_PLM_TASK_EXECUTION_STATUS")
    private String executionStatus;
    /**
     * 任务状态：1-正常、0-延期
     */
    @Dict(dicCode = "MB_SYSTEM_YES_NO")//1:是；0:否
    private String milestone;

    /**
     * 任务状态：1-正常、0-延期
     */
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String taskMembers;

    /**
     * 任务状态：1-正常、0-延期
     */
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String head;

    /**计划开始日期*/
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date planStartTime;
    /**计划结束时间*/
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date planEndTime;

    /**工期*/
    private BigDecimal duration;

    /**实际开始日期*/
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date actualStartTime;
    /**实际结束时间*/
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date actualEndTime;

    /**实际工期*/
    private BigDecimal actualDuration;
    /**
     * 任务状态：1-正常、0-延期
     */
    private String beforeTask;
    /**
     * 任务状态：1-正常、0-延期
     */
    private String afterTask;
    /**
     * 任务状态：1-正常、0-延期
     */
    private String desc;
    /**
     * 任务状态：1-正常、0-延期
     */
    private String notes;
    /**
     * 任务状态：1-正常、0-延期
     */
    private BigDecimal progress;
    /**
     * 任务状态：1-正常、0-延期
     */
    private BigDecimal normalWorkTime;
    /**
     * 任务状态：1-正常、0-延期
     */
    private BigDecimal overtimeWorkTime;
    /**
     * 任务状态：1-正常、0-延期
     */
    private Integer number;

    /**项目名称*/
    private String proName;

    /**项目经理*/
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String proLeader;

    //    @Column(name = "INFO_DEPT_ID_")
//    @Schema(description = "任务所属部门")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String infoDeptId;

    /**项目状态*/

    @Dict(dicCode = "ERP_PROJECT_INFO_PROSTATUS")
    private String proStatus;

    /**申请描述*/
    private String applyDesc;

    @Column(name = "APPROVAL_PLAN_")
    @Dict(dicCode = "ERP_PLM_APPROVAL_PLAN")
    @Schema(description = "审批方案")
    private Integer approvalPlan;

    @Column(name = "TASK_TEMPLATE_CODE_")
    @Schema(description = "当为模版时的任务编码")
    private String taskTemplateCode;

    @Column(name = "WORKFLOW_ID_")
    @Schema(description = "工作流ID")//当任务走工作流的时候，应有工作流的ID
    private String workflowId;

}
